*********************************
*** Appendix replication file ***
*********************************

*****************************************
*** Insert path file and load dataset ***
*****************************************

import excel "/Users/PathFile/LA turnover.xlsx", sheet("List1") firstrow clear

*******************************************************************
*** Running hausman test to decide fixed effects vs mixed model ***
*******************************************************************

xtset CountryID

xtreg TurnoverPct TermLimits TermLengthDays StaggeredElection Bicameralism Seats SeatChangePct, fe
estimates store fe_model

xtreg TurnoverPct TermLimits TermLengthDays StaggeredElection Bicameralism Seats SeatChangePct, re
estimates store re_model

hausman fe_model re_model

**********************************************************************
*** Robustness checks using hierarchical models for lower chambers ***
**********************************************************************

* Model 1
mixed TurnoverPct Seats SeatChangePct if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 2
mixed TurnoverPct Seats SeatChangePct Bicameralism if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 3
mixed TurnoverPct TermLimits Seats SeatChangePct Bicameralism if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 4
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 5
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 6
mixed TurnoverPct Seats SeatChangePct StaggeredElection if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 7
mixed TurnoverPct Seats SeatChangePct Bicameralism StaggeredElection if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 8
mixed TurnoverPct TermLimits Seats SeatChangePct Bicameralism StaggeredElection if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 9
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct StaggeredElection if LowerorOnlyChamber == 1 || CountryID:
estat ic

* Model 10
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection if LowerorOnlyChamber == 1 || CountryID:
estat ic

********************************************************************
*** Robustness checks using hierarchical models for all chambers ***
********************************************************************

* Model 1
mixed TurnoverPct Seats SeatChangePct || CountryID:
estat ic

* Model 2
mixed TurnoverPct Seats SeatChangePct Bicameralism || CountryID:
estat ic

* Model 3
mixed TurnoverPct TermLimits Seats SeatChangePct Bicameralism || CountryID:
estat ic

* Model 4
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct || CountryID:
estat ic

* Model 5
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism || CountryID:
estat ic

* Model 6
mixed TurnoverPct Seats SeatChangePct StaggeredElection || CountryID:
estat ic

* Model 7
mixed TurnoverPct Seats SeatChangePct Bicameralism StaggeredElection || CountryID:
estat ic

* Model 8
mixed TurnoverPct TermLimits Seats SeatChangePct Bicameralism StaggeredElection || CountryID:
estat ic

* Model 9
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct StaggeredElection  || CountryID:
estat ic

* Model 10
mixed TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection || CountryID:
estat ic

*****************************************************************
*** Robustness checks using OLS regression for lower chambers ***
*****************************************************************

* Model 1
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism if LowerorOnlyChamber == 1
vif

* Model 2
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism if LowerorOnlyChamber == 1, vce(cluster CountryID)
vif

* Model 3
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism i.CountryID if LowerorOnlyChamber == 1
vif

* Model 4
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection if LowerorOnlyChamber == 1
vif

* Model 5
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection if LowerorOnlyChamber == 1, vce(cluster CountryID)
vif

* Model 6
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection i.CountryID if LowerorOnlyChamber == 1
vif

***************************************************************
*** Robustness checks using OLS regression for all chambers ***
***************************************************************

* Model 1
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism
vif

* Model 2
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism, vce(cluster CountryID)
vif

* Model 3
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism i.CountryID
vif

* Model 4
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection
vif

* Model 5
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection, vce(cluster CountryID)
vif

* Model 6
regress TurnoverPct TermLengthDays TermLimits Seats SeatChangePct Bicameralism StaggeredElection i.CountryID
vif
